﻿using Microsoft.EntityFrameworkCore;


namespace _072.EFCore多对多
{
	public class MyDbContext : DbContext
	{
		public DbSet<Teacher> Teachers { get; set; }
		public DbSet<Student> Students { get; set; }
		protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
		{
			base.OnConfiguring(optionsBuilder);
			string connStr = "Server=10.34.10.12,1433;Database=fanzhineng;uid=fzn;Password=Ub6PjWV5r8J0&X!b;";
			optionsBuilder.UseSqlServer(connStr);
			

		}
		protected override void OnModelCreating(ModelBuilder modelBuilder)
		{
			base.OnModelCreating(modelBuilder);
			// 从当前程序集加载所有的IEntityTypeConfiguration
			modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);

		}

	}
}
